home *** CD-ROM | disk | FTP | other *** search
- property pSpr, pSodaFlavor, pFlavors, pHoseSprite, pTilt, pTimer, pPickItUp, pDraggingMember, pOrigMember
- global gSodaGunPopup
-
- on beginSprite me
- global gSodaIngredientsList
- pSpr = sprite(me.spriteNum)
- pFlavors = gSodaIngredientsList
- pHoseSprite = sprite(me.spriteNum - 1)
- pSodaFlavor = #water
- pOrigMember = pSpr.member
- pDraggingMember = nextMember(pOrigMember)
- pTilt = #left
- end
-
- on mouseEnter me
- if not draggingAnything() then
- pTimer = nowTicks()
- showToolTip(pSpr, customToolTip(me))
- end if
- end
-
- on rightMouseDown me
- if the stage = the activeWindow then
- pMouseLoc = the clickLoc
- sendSprite(gSodaGunPopup, #mShowPopup, pSpr)
- end if
- end
-
- on mouseUp me
- if the doubleClick then
- exit
- end if
- startedAt = nowTicks()
- repeat while ticksSince(startedAt) < 20
- if the mouseDown then
- exit
- end if
- end repeat
- if pPickItUp then
- pSpr.visible = 0
- mPickMeUp(me)
- end if
- end
-
- on mPickMeUp me, noToolTip, pickupLoc
- global gFloatSprite
- wasVis = pHoseSprite.visible
- pHoseSprite.visible = 0
- if wasVis then
- replaceDraggingAnything()
- end if
- returnToBar(VOID, 1)
- sendSprite(gFloatSprite, #mPickUpBottle, pSpr, VOID, VOID, pSodaFlavor, mGetPourSound(me), VOID, pickupLoc)
- end
-
- on mouseDown
- pPickItUp = 1
- if the doubleClick then
- repeat while the stillDown
- checkElapsedTime()
- updateStage()
- end repeat
- goSoda()
- else
- if draggingAnything() then
- replaceDraggingAnything()
- exit
- end if
- if modifierDown() then
- pMouseLoc = the clickLoc
- sendSprite(gSodaGunPopup, #mShowPopup, pSpr)
- exit
- end if
- menuDown = nowTicks()
- repeat while the stillDown
- checkElapsedTime()
- updateStage()
- if ticksSince(menuDown) > 30 then
- goSoda()
- exit
- end if
- end repeat
- end if
- end
-
- on mGetPourSound me
- return VOID
- end
-
- on mouseLeave me
- if not draggingAnything() then
- hideToolTip()
- end if
- end
-
- on mReplaceIt me
- pPickItUp = 0
- pSpr.visible = 1
- pHoseSprite.visible = 1
- end
-
- on mChangeSoda me, newFlavorInput, blipMe
- global gSodaAlerts, gSodaText, gUsedSoda
- gUsedSoda = 1
- oldFlavor = pSodaFlavor
- if voidp(getaProp(pFlavors, newFlavorInput)) then
- foundit = 0
- repeat with X = 1 to count(pFlavors)
- if pFlavors[X][#key] = newFlavorInput then
- foundit = 1
- exit repeat
- end if
- end repeat
- if foundit then
- pSodaFlavor = getPropAt(pFlavors, X)
- end if
- else
- pSodaFlavor = newFlavorInput
- end if
- if pSodaFlavor <> oldFlavor then
- sendSprite(gSodaText, #mChangeText, pSodaFlavor)
- refreshHelpWindow(pSodaFlavor)
- showToolTip(pSpr, pSodaFlavor)
- end if
- if gSodaAlerts[pSodaFlavor] = 1 then
- gSodaAlerts[pSodaFlavor] = 2
- end if
- if blipMe then
- forceToolTip(pSpr, pSodaFlavor, pSpr.loc)
- end if
- mPickMeUp(me)
- end
-
- on mouseWithin me
- if draggingAnything() then
- else
- if tipTickRange(pTimer) then
- forceToolTip(pSpr, customToolTip(me))
- else
- dismissToolTip()
- end if
- end if
- end
-
- on customToolTip me
- global gHelpPointer
- if modifierDown() or not gHelpPointer then
- return pSodaFlavor
- else
- return #sodagun
- end if
- end
-